package com.hifar.test.equituit.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hifar.test.equip.pojo.VO.ResEquipUnitVO;
import com.hifar.test.equituit.pojo.EquipUnitSearchVo;
import com.hifar.test.equituit.pojo.HfResEquipUnit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 设备-项目-关闭表 mapper接口
 * </p>
 *
 * @author wangkepeng
 * @since 2024-12-18 14:14:04
 */
@Mapper
public interface HfResEquipUnitMapper extends BaseMapper<HfResEquipUnit> {

	@Select("select * from (select t.*,u.UNIT_NAME,P.EQUIP_NAME,u.UNIT_CODE,P.EQUIP_CODE  from HF_RES_EQUIP_UNIT t "
			+ " left join  hf_prj_unit_base u on t.unit_id=u.id left join hf_res_equip p on t.equip_id=p.id ) x  ${ew.customSqlSegment}  ")
	Page<EquipUnitSearchVo> selectEntityVoPage(Page<EquipUnitSearchVo> rowPage, @Param(Constants.WRAPPER) QueryWrapper wrapper);


	@Select("select * from (select t.*,u.UNIT_NAME,P.EQUIP_NAME,u.UNIT_CODE,P.EQUIP_CODE  from HF_RES_EQUIP_UNIT t "
			+ " left join  hf_prj_unit_base u on t.unit_id=u.id left join hf_res_equip p on t.equip_id=p.id ) x  ${ew.customSqlSegment}  ")
	List<EquipUnitSearchVo> listEntityVo(@Param(Constants.WRAPPER) QueryWrapper wrapper);

	/**
	 * 查询设备下试验项目
	 *
	 * @param equipId 设备id
	 * @return
	 */
	List<ResEquipUnitVO> selectByEquipId(@Param("equipId") String equipId);
}